﻿<UserControl x:Class="Rio.Framework.Pages.Controls.Historic.HistoricDashboard"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:historic="clr-namespace:Rio.Framework.Pages.Controls.Historic"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:behaviors="clr-namespace:Rio.Framework.Pages.AppCode.Helpers.Behavior"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             Name="historicDashboard"
             d:DesignHeight="300"
             d:DesignWidth="400"
             Loaded="historicDashboardLoaded">

    <UserControl.Resources>
        <DataTemplate x:Key="IndexesItemTemplate">
            <Grid>
                <StackPanel Orientation="Horizontal">
                    <TextBlock TextWrapping="Wrap"
                               Text="{Binding IndexLabel}"
                               FontWeight="Bold" />
                    <TextBlock TextWrapping="Wrap"
                               Text="="
                               Margin="5,0"
                               FontWeight="Bold" />
                    <TextBlock TextWrapping="Wrap"
                               Text="{Binding IndexValue}"
                               FontStyle="Italic" />
                </StackPanel>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="IndexesRowDetail">
            <Grid DataContext="{Binding}"
                  Margin="20,0,0,0">
                <telerik:ItemsControl ItemsSource="{Binding Indexes, Mode=TwoWay}"
                                      ItemTemplate="{StaticResource IndexesItemTemplate}" />
            </Grid>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">

        <telerik:RadTabControl BackgroundVisibility="Collapsed"
                               Background="#4CFFFFFF">
            <telerik:RadTabItem x:Name="LastIndexationsTabItem">
                <Grid Margin="10,0,10,10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <telerik:RadButton x:Name="LastIndexationsDisplayButton"
                                       Click="Open_Click"
                                       IsEnabled="False"
                                       HorizontalAlignment="Left"
                                       Width="100"
                                       Margin="0,5,0,0" />
                    <telerik:RadGridView x:Name="LastIndexationsRadGridView"
                                         Margin="0,5,0,0"
                                         Grid.Row="1"
                                         AutoGenerateColumns="False"
                                         ShowGroupPanel="False"
                                         ItemsSource="{Binding LastIndexations, ElementName=historicDashboard, Mode=TwoWay}"
                                         SelectedItem="{Binding SelectedLastIndexations, ElementName=historicDashboard, Mode=TwoWay}"
                                         RowDetailsTemplate="{StaticResource IndexesRowDetail}">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewToggleRowDetailsColumn UniqueName="LastIndexationsIndexHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionDate, StringFormat='\{0:dd/MM/yyyy\}'}"
                                                        UniqueName="LastIndexationsDateHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionTime}"
                                                        UniqueName="LastIndexationsHourHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding OrganizationName}"
                                                        UniqueName="LastIndexationsOrganizationHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding FoldertypeName}"
                                                        UniqueName="LastIndexationsFolderTypeHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding IndexedDocumentsCount}"
                                                        UniqueName="LastIndexationsNbIndexedDocsHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ItemName}"
                                                        UniqueName="LastIndexationsItemHeader" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </Grid>
            </telerik:RadTabItem>
            <telerik:RadTabItem x:Name="LastConsultationsTabItem">
                <Grid Margin="10,0,10,10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <telerik:RadButton x:Name="LastConsultationsDisplayButton"
                                       HorizontalAlignment="Left"
                                       Click="Open_Click"
                                       IsEnabled="False"
                                       Width="100"
                                       Margin="0,5,0,0" />
                    <telerik:RadGridView x:Name="LastConsultationsRadGridView"
                                         Margin="0,5,0,0"
                                         Grid.Row="1"
                                         ShowGroupPanel="False"
                                         AutoGenerateColumns="False"
                                         ItemsSource="{Binding LastConsultations, ElementName=historicDashboard, Mode=TwoWay}"
                                         SelectedItem="{Binding SelectedLastConsultations, ElementName=historicDashboard, Mode=TwoWay}"
                                         RowDetailsTemplate="{StaticResource IndexesRowDetail}">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewToggleRowDetailsColumn UniqueName="LastConsultationsIndexHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionDate, StringFormat='\{0:dd/MM/yyyy\}'}"
                                                        UniqueName="LastConsultationsDateHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionTime}"
                                                        UniqueName="LastConsultationsHourHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding OrganizationName}"
                                                        UniqueName="LastConsultationsOrganizationHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding FoldertypeName}"
                                                        UniqueName="LastConsultationsFolderTypeHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding DocumentsCountInFolder}"
                                                        UniqueName="LastConsultationsNbDocsHeader" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </Grid>
            </telerik:RadTabItem>
            <telerik:RadTabItem x:Name="LastSearchesTabItem">
                <Grid Margin="10,0,10,10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <telerik:RadButton x:Name="LastSearchesDisplayButton"
                                       HorizontalAlignment="Left"
                                       Click="Open_Click"
                                       IsEnabled="False"
                                       Width="100"
                                       Margin="0,5,0,0" />
                    <telerik:RadGridView x:Name="LastSearchesRadGridView"
                                         Margin="0,5,0,0"
                                         Grid.Row="1"
                                         ShowGroupPanel="False"
                                         AutoGenerateColumns="False"
                                         ItemsSource="{Binding LastSearches, ElementName=historicDashboard, Mode=TwoWay}"
                                         SelectedItem="{Binding SelectedLastSearches, ElementName=historicDashboard, Mode=TwoWay}"
                                         RowDetailsTemplate="{StaticResource IndexesRowDetail}">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewToggleRowDetailsColumn UniqueName="LastSearchesIndexHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding Identifier}"
                                                        Header="ID" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionDate, StringFormat='\{0:dd/MM/yyyy\}'}"
                                                        UniqueName="LastSearchesDateHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionTime}"
                                                        UniqueName="LastSearchesHourHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding OrganizationName}"
                                                        UniqueName="LastSearchesOrganizationHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding FoldertypeName}"
                                                        UniqueName="LastSearchesFolderTypeHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding FoldersCountResultInSearch}"
                                                        UniqueName="LastSearchesNbResultsHeader" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </Grid>
            </telerik:RadTabItem>
            <telerik:RadTabItem x:Name="SavedSearchesTabItem">
                <Grid Margin="10,0,10,10">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <StackPanel HorizontalAlignment="Left"
                                Margin="0,5,0,0"
                                Orientation="Horizontal">
                        <telerik:RadButton x:Name="SavedSearchesDisplayButton"
                                           Click="Open_Click"
                                           IsEnabled="False"
                                           Height="25"
                                           Width="100" />
                        <telerik:RadButton x:Name="SavedSearchesDeleteButton"
                                           Click="Delete_Click"
                                           IsEnabled="False"
                                           Height="25"
                                           Width="100"
                                           Margin="10,0,0,0" />
                    </StackPanel>
                    <telerik:RadGridView x:Name="SavedSearchesRadGridView"
                                         Margin="0,5,0,0"
                                         Grid.Row="1"
                                         AutoGenerateColumns="False"
                                         ShowGroupPanel="False"
                                         ItemsSource="{Binding SavedSearches, ElementName=historicDashboard, Mode=TwoWay}"
                                         SelectionMode="Multiple"
                                         SelectedItem="{Binding SelectedSavedSearches, ElementName=historicDashboard, Mode=TwoWay}"
                                         RowDetailsTemplate="{StaticResource IndexesRowDetail}">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewSelectColumn />
                            <telerik:GridViewToggleRowDetailsColumn UniqueName="SavedSearchesIndexHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding Identifier}"
                                                        Header="ID" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionDate, StringFormat='\{0:dd/MM/yyyy\}'}"
                                                        UniqueName="SavedSearchesDateHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding ActionTime}"
                                                        UniqueName="SavedSearchesHourHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding OrganizationName}"
                                                        UniqueName="SavedSearchesOrganizationHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding FoldertypeName}"
                                                        UniqueName="SavedSearchesFolderTypeHeader" />
                            <telerik:GridViewDataColumn IsReadOnly="True"
                                                        DataMemberBinding="{Binding FoldersCountResultInSearch}"
                                                        UniqueName="SavedSearchesNbResultsHeader" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </Grid>
            </telerik:RadTabItem>
        </telerik:RadTabControl>

    </Grid>
</UserControl>
